package com.ethan.cj.ssm.dao.provider;

import org.apache.ibatis.jdbc.SQL;

import java.util.Map;

public class TestDaoProvider {

    public String count(Map<String, Object> parameters) {
        return new SQL() {{
            SELECT("COUNT(*)").FROM("`user`");
            WHERE("1=1");
            final String name = (String) parameters.get("name");
            if (name != null) {
                WHERE("`username` LIKE '%"+name+"%'");
            }
        }}.toString();
    }
}
